<% content_for :css do %>
  <%= stylesheet_link_tag 'index','storefronts_index' %>
<% end %>
<% content_for :title do %>-销售店面<% end %>
<div class='body'>
  <div class='top'>
    <div class='title'>
      <b>系统设置</b><span>销售店面</span>
    </div>
  </div>
  <div class="search">
    <%= form_tag storefronts_url,
          :method => :get do %> 
      <%= hidden_field_tag :target, params[:target] %>
      <%= text_field_tag :key_words, params[:key_words] ,:class => :search, :onfocus => 'select()' %>
      <%= submit_tag '查找店面', :class => :bb %>
      <%= link_to '新增店面', new_storefront_url,  :class => :new %>
    <% end %>
  </div>  
  <div class="page">
    <div class="total_currnet"><p>共</p><b><%= @storefronts.size %></b><p>间店面</p></div>
  </div>
  <div class="index">  
    <% @storefronts.each do |storefront| %>
    <div id='storefront_<%= storefront.id %>' class="monomer <%= storefront.status %>">
      <div class="content">
        <div class="title">
          <div class="name">
            <b><%= storefront.name %></b>
          </div>
          <div class="information">
            <p class="message">
              <%= storefront.address %>
            </p>
            <p class="statistics">
              <%= storefront.link_phone %>
            </p>
            <p class="statistics">
              <%= storefront.link_man %>
            </p>
          </div>
        </div>      
        <div class="article">
          <%= storefront.remark %>
        </div>
      </div>
      <div class="operate">
        <%= link_to '修改',edit_storefront_url(storefront), :class => 'button' %>
        <% if storefront.status.visible? %>
          <% if storefront.posts.empty? %>
          <%= link_to '隐藏',
                hide_storefront_url(storefront),
                :confirm => '确认要设置为隐藏吗？',
                :method => :put,
                :class => 'button',
                :id => "hide_storefront_#{storefront.id}_link" 
           %>
           <% else %>
           <span class='none' title='请先隐藏从属的<%= storefront.posts.size %>名员工后，方可隐藏该店面'>隐藏</span>
           <% end %>           
         <% else %>
         <%= link_to '可见',
              visible_storefront_url(storefront),
              :confirm => '确认要设置为可见吗？',
              :method => :put,
              :class => 'button',
              :id => "visible_storefront_#{storefront.id}_link"
         %>
         <% end %>
      </div>
    </div>
    <% end %>
  </div>  
  <div class="page">
    <div class="total_currnet"><p>共</p><b><%= @storefronts.size %></b><p>间店面</p></div>
  </div>
</div>

        